<template>
	<app-layout>
		<view class="box">
			<app-rich-text background="#ffffff" :loading="loading" :content="cases.content"></app-rich-text>
<!-- 			<view>{{cases.content}}</view>
			<bd-detail :detail="cases.content"></bd-detail>
			<view class="top">
			<swiper indicator-dots autoplay :interval="3000" :duration="500">
				<swiper-item v-for="(item,index) in cases.pic_url" :key="index">
					<image :src="cases.pic_url[index].pic_url"></image>
				</swiper-item>
			</swiper>
		</view>
			<view class="conton">
			<view class="c1">
				<text>{{cases.title}}</text>
				<button class="share" open-type="share">
					<view class="icon">分享</view>
				</button>
			</view>
			<view class="xx">
				<image src="../../static/image/icon/star.png" mode="" v-for="item in 5" :key="item"></image>
			</view>

			<view class="button">
				<button @click="getDate(cases.last_id)" type="primary">上一个</button>
				<button @click="getDate(cases.next_id)" type="primary">下一个</button>
			</view>
		</view> -->
		</view>
	</app-layout>
</template>

<script>
	import appRichText from "@/components/basic-component/app-rich/parse.vue";
	export default {
		data() {
			return {
				cases: {
					content: ' '
				},
				loading: true,
			}
		},
		components: {
			appRichText,
		},
		methods: {
			getDate(id) {
				let self = this;
				if (!id) {
					uni.showToast({
						icon: 'none',
						mask: true,
						title: '没有数据了', //保存路径
						duration: 1000,
					});
					return;
				}
				self.$request({
					url: self.$api.cases.detail,
					data: {
						id: id || 0,
					}
				}).then(response => {
					self.$hideLoading();
					if (response.code == 0) {
						self.loading = false;
						self.cases = response.data.res;
						console.log(self.cases)
						uni.setNavigationBarTitle({
							title: self.cases.title
						});
					}
				}).catch(e => {
					self.$hideLoading();
				});
			},
		},

		onLoad(options) {
			// console.log(options)
			this.getDate(options.id);
		},
		// #ifdef MP
		onShareAppMessage() {
			let cases = this.cases;
			let params = {
				id: cases.id,
			}
			return this.$shareAppMessage({
				title: cases.title,
				imageUrl: cases.pic_url[0].pic_url,
				path: '/pages/cases/detail',
				params: params
			});
		},
		// #endif
	}
</script>

<style lang="scss" scoped>
	.button {
		margin-top: 20rpx;
		display: flex;
	}

	.button button {
		padding: 0 40rpx;
	}

	.input {
		margin-top: 20rpx;
		font-size: 0.8em;
		padding-bottom: 10rpx;
		border-bottom: solid #C0C4CC 1px;
	}

	.xx image {
		width: 30rpx;
		height: 30rpx;
	}

	.top {
		height: 480upx;

		swiper {
			height: 480upx;
		}
	}

	.top image {
		margin-left: 50%;
		transform: translateX(-50%);
	}

	.conton {
		padding: 0 40rpx;
	}

	.conton .c1 {
		margin-top: 20rpx;
		display: flex;
		justify-content: space-between;
	}

	.icon {
		background-repeat: no-repeat;
		padding-left: 40rpx;
		background-size: contain;
		background-image: url('../../static/image/share.png');
		background-size: 40rpx;
		background-position: left center;
	}

	.share {}
</style>